{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "46f23869",
   "metadata": {},
   "source": [
    "# Python进阶-ML模型应用1_Linear Regression线性回归\n",
    "\n",
    "\n",
    "线性回归，是机器学习中常用的一种回归分析方法，用于建立因变量与一个或多个自变量之间的线性关系模型。这种模型是一种线性模型，它将各个特征进行线性组合，实现对新输入的预测。\n",
    "\n",
    "在线性回归模型中，因变量与自变量之间存在线性关系，并试图找到最佳拟合直线来描述这种关系。其数学表达式为：Y = β0 + β1X1 + β2X2 + ... + βn*Xn + ε，其中Y是因变量，X是自变量，β是回归系数。如果回归分析中只包括一个自变量和一个因变量，且二者的关系可用一条直线近似表示，这种回归分析称为一元线性回归分析。如果回归分析中包括两个或两个以上的自变量，且因变量和自变量之间是线性关系，则称为多元线性回归分析。\n",
    "\n",
    "在线性回归算法中，我们会通过cost/loss函数计算权重和偏移量。损失函数(Loss/Error Function)是计算单个训练集的误差，而代价函数(Cost Function)则是计算整个训练集所有损失之和的平均值。\n",
    "\n",
    "在实际应用中，例如预测房价的例子中，我们可以通过构建线性回归模型来寻找房价与面积之间的线性关系，从而利用该模型进行房价预测。总的来说，线性回归是一种强大且灵活的工具，可以应用于许多实际问题中。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1628dac",
   "metadata": {},
   "source": [
    "## 应用案例（一）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c44f81f",
   "metadata": {},
   "source": [
    "### 1、下载安装sklearn库\n",
    "\n",
    "Anaconda Prompt：pip install sklearn\n",
    "\n",
    "`sklearn`，全称scikit-learn，是一个基于Python的开源机器学习工具包。它提供了各种分类、回归和聚类算法，包括但不限于支持向量机、随机森林、梯度提升、k均值和DBSCAN等。此外，它还包含了许多常用的机器学习算法、预处理技术、模型选择和评估工具等，可以方便地进行数据挖掘。这个库通过集成NumPy, SciPy和Matplotlib等Python数值计算的库实现了高效的算法应用。可以说，`sklearn`是机器学习中一个非常常用且功能强大的Python第三方模块。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f3f50260",
   "metadata": {},
   "source": [
    "### 2、导入库函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "d67d49dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.linear_model import LinearRegression#用于从sklearn库中导入线性回归模型。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "35d4cb1c",
   "metadata": {},
   "source": [
    "### 3、加载数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "ad874db8",
   "metadata": {},
   "outputs": [],
   "source": [
    "x=np.array([10,20,30,40,50,60])#腰围——independent variable（独立型变量）——特征\n",
    "y=np.array([15,45,50,70,110,130])#体重——dependent variable（依赖型变量）——预测值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "55e212cb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10, 20, 30, 40, 50, 60])"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "0ac1abc8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 15,  45,  50,  70, 110, 130])"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b3bf0a9e",
   "metadata": {},
   "source": [
    "### 4、创建线性回归对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "035aa1f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "linreg=LinearRegression()#创建LinearRegression类的实例对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "fef7f776",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=x.reshape(-1,1)#-1表示所有行，1表示变成1列。——将数组x重塑为列向量。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "6ef094a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[10],\n",
       "       [20],\n",
       "       [30],\n",
       "       [40],\n",
       "       [50],\n",
       "       [60]])"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "79425016",
   "metadata": {},
   "source": [
    "```x=np.array([10,20,30,40,50,60])```\n",
    "\n",
    "```X=x.reshape(-1,1)#-1表示所有行，1表示变成1列。——将数组x重塑为列向量。```\n",
    "\n",
    "在这两句代码中，`x`是一个一维的NumPy数组，而`X`是一个二维的NumPy数组。\n",
    "\n",
    "将`x`转换为`X`的目的是将其重塑为一个列向量，其中每个元素都是原始数组中的一个元素。这样做是为了符合某些机器学习算法的要求，例如线性回归模型需要输入的数据是二维的（特征矩阵）。\n",
    "\n",
    "具体来说，`reshape(-1, 1)`函数将`x`重塑为一个列向量，其中`-1`表示自动计算该维度的大小。在这种情况下，由于`x`只有6个元素，所以重塑后的`X`将是一个6行1列的二维数组。\n",
    "\n",
    "因此，通过将`x`转换为`X`，我们可以将其作为机器学习算法的输入数据进行进一步处理和训练。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4be9b918",
   "metadata": {},
   "source": [
    "x与X的区别：\n",
    "\n",
    "X和原本的x在形状上有所不同。原本的x是一个一维数组，而X是一个二维数组，其中每一行都是原本的x中的元素。具体来说，如果原本的x包含n个元素，那么X将包含n行和1列。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "b8b762d6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.int32"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(x[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "e0e3f9fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.ndarray"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(X[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e41911f3",
   "metadata": {},
   "source": [
    "### 5、模型训练"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22c56789",
   "metadata": {},
   "source": [
    "1、fit()：在机器学习中，fit函数是一个核心方法，主要用于训练模型。以线性回归模型为例，fit函数可以用于计算最佳拟合参数。\n",
    "\n",
    "具体来说，当我们创建一个线性回归模型对象后，可以使用fit函数来拟合我们的数据。例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "05ea9ec2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linreg.fit(X,y)#因为本应用案例数据集很小，所以并没有做训练集和测试集的拆分"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "03d72edb",
   "metadata": {},
   "source": [
    "### 6、预测结果\n",
    "\n",
    "因为此案例中的数据量非常小，所以没有划分训练集和测试集，因为意义不大。所以，此处的训练集和测试集是相同的。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "0a03bdb4",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_predict=linreg.predict(X)#使用线性回归模型 linreg 对输入数据 X 进行预测，并将预测结果存储在变量 y_predict 中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "1bd612d8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 13.57142857,  36.14285714,  58.71428571,  81.28571429,\n",
       "       103.85714286, 126.42857143])"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_predict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "f90abe5f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 15,  45,  50,  70, 110, 130])"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d1187855",
   "metadata": {},
   "source": [
    "### 7、绘制模型图像"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "f3f93e10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAfkElEQVR4nO3deXxU5b3H8c8vSLXRWwRFS6tJ6r1UQBGXVLF6WwVxr0tbW2rqxaXEq1ix2ro01j1Wq614rVukKr2dKhaVzYpgcGGxagAlQEC4alIUJS6Amoosv/vHM4GAQUhmOZkz3/fr5WtmzmQyv/Nq+fLwnOc8P3N3REQkXgqiLkBERNJP4S4iEkMKdxGRGFK4i4jEkMJdRCSGtou6AIBdd93VS0pKoi5DRCSnzJo16z13797aex0i3EtKSqipqYm6DBGRnGJm9Vt6T9MyIiIxpHAXEYkhhbuISAwp3EVEYkjhLiISQwp3EZEIJGoTlIwooeDaAkpGlJCoTaT193eIpZAiIvkkUZugfEI5TWuaAKhfWU/5hHIAyvqWpeU7NHIXEcmyiuqKDcHerGlNExXVFWn7DoW7iEiWNaxsaNPx9lC4i4hkWVGXojYdbw+Fu4hIllUOrKSwc+Emxwo7F1I5sDJt36ELqiIiWVbWt4wZTxRTdXsJ6z78Gp26vs2QS9+krO/hafsOjdxFRLIskYBR1x/Oug/3AApY9+EejLr+cBJpXA2pcBcRybKKCmhqcn7AGAbyNABNTeF4uijcRUSyzOsbGM9JjOE0hnHnhuMN6Vssozl3EZGsWbcO7riDBXYluHMJ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ixN/isUYAwh7DNyznEI9/HAkOTzIYQ56dgwMwP+BNS5+x9avBXb8zaz7ma2c/L5l4GjgIXE9Jzd/Qp338PdS4DBwFR3/ykxPV8AM9vRzP6t+TlwNDCPGJ+zu78D/NPM9k4eGggsIEPnnFN3qJrZQ8ARhC0y3wWuBsYCjwBFQANwmrt/EFGJaWdmhwPTgFo2zsf+mjDvHsvzNrP9gFFAJ8IA5BF3v87MdiGm59zMzI4AfunuJ8b5fM1sL8JoHcJ0xV/dvTLO5wxgZvsDI4EvAa8DZ5H8/zhpPuecCncREdk2cZiWERGRzSjcRURiSOEuIhJDCncRkRhSuIuIxJDCXUQkhhTuIiIx9P9zqVISjAKGtQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X,y,c=\"g\")#真实值\n",
    " \n",
    "plt.scatter(X,y_predict,c=\"b\")#预测值\n",
    " \n",
    "plt.plot(X,y_predict,'Red')#回归模型\n",
    " \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "50c39fa7",
   "metadata": {},
   "source": [
    "### 8、应用模型进行预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "cb7a1a92",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([160.28571429])"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linreg.predict([[75]])#注意线性回归模型传入的参数必须是二维数组"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b99ef17",
   "metadata": {},
   "source": [
    "### 9、评估指标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "282d2133",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "均方误差（MSE）： 55.71428571428573\n",
      "均方根误差（RMSE）： 7.46420027292179\n",
      "平均绝对误差（MAE）： 6.666666666666668\n",
      "R2分数： 0.9638610038610038\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n",
    "\n",
    "# 评估指标\n",
    "mse = mean_squared_error(y, y_predict)\n",
    "rmse = np.sqrt(mse)\n",
    "mae = mean_absolute_error(y, y_predict)\n",
    "r2 = r2_score(y, y_predict)\n",
    "\n",
    "print(\"均方误差（MSE）：\", mse)\n",
    "print(\"均方根误差（RMSE）：\", rmse)\n",
    "print(\"平均绝对误差（MAE）：\", mae)\n",
    "print(\"R2分数：\", r2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aadf7ea2",
   "metadata": {},
   "source": [
    "这些指标都是用来衡量线性回归模型的预测性能的。\n",
    "\n",
    "- 均方误差（MSE）：它是实际观察值与预测值之间差的平方的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MSE为55.71428571428573，比较大，说明模型的预测精度不高。\n",
    "- 均方根误差（RMSE）：它是MSE的平方根，也是衡量模型预测精度的一种常用指标。在这个例子中，RMSE为7.46420027292179，也比较大，说明模型的预测精度不高。\n",
    "- 平均绝对误差（MAE）：它是实际观察值与预测值之间差的绝对值的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MAE为6.666666666666668，也比较大，说明模型的预测精度不高。\n",
    "- R2分数：它是决定系数，用于衡量模型对数据的拟合程度。它的取值范围在0到1之间，越接近1表示模型对数据的拟合程度越高。在这个例子中，R2分数为0.9638610038610038，比较接近1，说明模型对数据的拟合程度较高。\n",
    "\n",
    "综合来看，这个线性回归模型对数据的拟合程度较高，但预测精度不高。可能需要进一步优化模型或者考虑使用其他类型的回归模型来提高预测精度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cb534d44",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "bbea3a77",
   "metadata": {},
   "source": [
    "## 应用案例（二）——Age, Weight, Height, BMI Analysis\n",
    "\n",
    "数据来源于kaggle：\n",
    "\n",
    "https://www.kaggle.com/datasets/rukenmissonnier/age-weight-height-bmi-analysis"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24336b87",
   "metadata": {},
   "source": [
    "### Step1：加载函数库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "9da2ffcf",
   "metadata": {},
   "outputs": [],
   "source": [
    "#处理数据\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "#绘制图像\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "#机器学习模型\n",
    "from sklearn.linear_model import LinearRegression"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5aa5c2d3",
   "metadata": {},
   "source": [
    "### Step2：获取数据（Get Data）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "c27a5d63",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"./kaggle-data/bmi.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9caa041",
   "metadata": {},
   "source": [
    "### Step3：数据分析（Data Analysis）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f894b0d4",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Age</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Bmi</th>\n",
       "      <th>BmiClass</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>61</td>\n",
       "      <td>1.85</td>\n",
       "      <td>109.30</td>\n",
       "      <td>31.935720</td>\n",
       "      <td>Obese Class 1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>60</td>\n",
       "      <td>1.71</td>\n",
       "      <td>79.02</td>\n",
       "      <td>27.023700</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>60</td>\n",
       "      <td>1.55</td>\n",
       "      <td>74.70</td>\n",
       "      <td>31.092612</td>\n",
       "      <td>Obese Class 1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>60</td>\n",
       "      <td>1.46</td>\n",
       "      <td>35.90</td>\n",
       "      <td>16.841809</td>\n",
       "      <td>Underweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>60</td>\n",
       "      <td>1.58</td>\n",
       "      <td>97.10</td>\n",
       "      <td>38.896010</td>\n",
       "      <td>Obese Class 2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>736</th>\n",
       "      <td>34</td>\n",
       "      <td>1.86</td>\n",
       "      <td>95.70</td>\n",
       "      <td>27.662157</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>737</th>\n",
       "      <td>44</td>\n",
       "      <td>1.91</td>\n",
       "      <td>106.90</td>\n",
       "      <td>29.302925</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>738</th>\n",
       "      <td>25</td>\n",
       "      <td>1.82</td>\n",
       "      <td>88.40</td>\n",
       "      <td>26.687598</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>739</th>\n",
       "      <td>35</td>\n",
       "      <td>1.88</td>\n",
       "      <td>98.50</td>\n",
       "      <td>27.868945</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>740</th>\n",
       "      <td>45</td>\n",
       "      <td>1.93</td>\n",
       "      <td>109.90</td>\n",
       "      <td>29.504148</td>\n",
       "      <td>Overweight</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>741 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Age  Height  Weight        Bmi       BmiClass\n",
       "0     61    1.85  109.30  31.935720  Obese Class 1\n",
       "1     60    1.71   79.02  27.023700     Overweight\n",
       "2     60    1.55   74.70  31.092612  Obese Class 1\n",
       "3     60    1.46   35.90  16.841809    Underweight\n",
       "4     60    1.58   97.10  38.896010  Obese Class 2\n",
       "..   ...     ...     ...        ...            ...\n",
       "736   34    1.86   95.70  27.662157     Overweight\n",
       "737   44    1.91  106.90  29.302925     Overweight\n",
       "738   25    1.82   88.40  26.687598     Overweight\n",
       "739   35    1.88   98.50  27.868945     Overweight\n",
       "740   45    1.93  109.90  29.504148     Overweight\n",
       "\n",
       "[741 rows x 5 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4bf794fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Obese Class 1', 'Overweight', 'Underweight', 'Obese Class 2',\n",
       "       'Obese Class 3', 'Normal Weight'], dtype=object)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"BmiClass\"].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "3faa9156",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Age</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Bmi</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Age</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.023128</td>\n",
       "      <td>0.109610</td>\n",
       "      <td>0.139157</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Height</th>\n",
       "      <td>0.023128</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.607672</td>\n",
       "      <td>0.433309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Weight</th>\n",
       "      <td>0.109610</td>\n",
       "      <td>0.607672</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.966921</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Bmi</th>\n",
       "      <td>0.139157</td>\n",
       "      <td>0.433309</td>\n",
       "      <td>0.966921</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Age    Height    Weight       Bmi\n",
       "Age     1.000000  0.023128  0.109610  0.139157\n",
       "Height  0.023128  1.000000  0.607672  0.433309\n",
       "Weight  0.109610  0.607672  1.000000  0.966921\n",
       "Bmi     0.139157  0.433309  0.966921  1.000000"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.corr()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "29c48346",
   "metadata": {},
   "source": [
    "变量相关性分析：\n",
    "\n",
    "Bmi-Height:0.433309\n",
    "\n",
    "Weight-Height:0.607672\n",
    "\n",
    "Bmi-Weight:0.966921"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "8c0dfb31",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAV0AAAD8CAYAAADUv3dIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXRUlEQVR4nO3dfZRkdX3n8feHAcLDDKIMEhkgPByQIIpGgoJREWOCHnVWZRViNCrZCavIIuYk7O45IZqTE41ZBBUdRpyDZBU0SpKBDKK7ighCmNHlcWTIOJwDnUHIMDI8hIDT/dk/7m2mbLq7bvVU3bp1+/Pi3DN1H+rWt6qbb/36+/v97pVtIiKiHjsNO4CIiPkkSTciokZJuhERNUrSjYioUZJuRESNknQjImqUpBsRMQNJKyU9JOnOGfZL0mckbZB0u6Tf6HbOJN2IiJldCpw8y/43AoeXyzLgC91OmKQbETED29cDW2Y5ZClwmQs3A3tLesFs59y5nwFO5xebN2bKW2n3/V897BAa46C9nj/sEBpj4c67DTuExrj9ZzdpR8/RS87Zdd/D/oiihTpphe0VPbzcEuD+jvWxctsDMz1h4Ek3IqJWE+OVDy0TbC9JdqrpviRmTfpJuhHRLp6o89XGgAM71g8ANs32hNR0I6JdJiaqLztuFfDechTDK4GttmcsLUBauhHRMu5jS1fS5cCJwGJJY8B5wC7F63g5sBp4E7AB+Hfg/d3OmaQbEe0yvq1vp7J9Wpf9Bj7UyzmTdCOiXXroSBuGJN2IaJd6O9J6lqQbEe3Snw6ygUnSjYhW6WdH2iAk6UZEu6SlGxFRo/FfDDu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P8UUF8FXgbzr23WJ7rDzvrRRfXDf0LfL+mmztngCcT5F0T6BIuv8K/A6z/5yPBDbavrdcv5xfngr7T7afAp6S9BCw34DeRx2e+Z2RdDxwmaSjy31rbD9Q7vsp8O1y+x0UXzrRRyOfdCXtQ/GtfbQkU/zPZeDvZ3oKcJft42sKsW47AcfbfrJzY0cS7uapjsfjNPt3ZLKu+2KK8sL9wEeBR4HvAku6/Jy7fSij9FlUZvsmSYuBfctNne9zomN9gpa85yZpQ033FOAy279m+2DbBwL3ApuBd5S13f2AE8vj1wP7lt/2SNpF0oumO/GI+jZw5uSKpJdOc8zNwDvKx1U7Hh+j+DO7SW4E3gxssT1uewtFR9fxwNfo/nO+GzhU0sHl+rsqvGYTP4eeqBjhswB4eNixzEdtSLqn8exW7TcpOn7GKFpAFwP/DGy1/TRFov6kpNuAW9neIdMGZwHHSrpd0jpgas0WihrdOZJuoajvba1w3hXANQ3qSIPiz9/FFF8indu22n6ILj/n8q+BDwLfknQD8CBdPgvbDwM3SrpzxDrSdi87/26l+EL6A9vjQ45pXmr1NGBJC20/XpYgbqHoFPrZsOMaNhXjbZ+0bUmnAqfZXjrsuIah43dEwEXAv9j+9LDjivZqe73makl7A7sCf5GE+4yXA58rE80jjNbIjX77L5L+gOJ35P9R/FUUMTCtbulGRDRNG2q6EREjI0k3IqJGSboRETVK0o2IqFGSbkREjf4/MUVmQaO7QbUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(df.corr())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c067fde",
   "metadata": {},
   "source": [
    "### Step4：划分特征集（独立变量independent variable）和响应集（dependent variable）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "fae5ceb1",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = df[\"Weight\"]\n",
    "x = np.array(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "e5c3ad66",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=x.reshape(-1,1)#-1表示所有行，1表示变成1列。——将数组x重塑为列向量。(因为fit函数中的X必须是二维数组)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "3e90ec22",
   "metadata": {},
   "outputs": [],
   "source": [
    "y = df[\"Bmi\"]\n",
    "y = np.array(y)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "772586db",
   "metadata": {},
   "source": [
    "### Step5：划分训练集与测试集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "ef76ec2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    " \n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=42)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da16620b",
   "metadata": {},
   "source": [
    "### Step6：创建模型并训练"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "b81fe2a5",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linreg=LinearRegression()#创建LinearRegression类的实例对象\n",
    "linreg.fit(X,y)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "94f07d81",
   "metadata": {},
   "source": [
    "### Step7:模型预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "7f6ee8f8",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_predict=linreg.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "058a8427",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([27.60618121, 26.72693972, 42.01136411, 15.74471583, 23.87631715,\n",
       "       43.80855584, 26.66611169, 42.01136411, 37.86399859, 25.33895473,\n",
       "       21.82751859, 25.78134038, 34.24196604, 17.01657459, 24.50948162,\n",
       "       20.72155445, 27.85502314, 27.13614645, 29.76281128, 26.6135784 ,\n",
       "       24.53436582, 65.51310205, 41.18189101, 25.69839307, 24.45418342,\n",
       "       24.06737246, 26.58592929, 25.34171964, 23.4864648 , 20.16857238,\n",
       "       14.83229541, 26.5886942 , 24.53713073, 31.91944135, 35.34793018,\n",
       "       25.42190204, 18.42667886, 26.0799507 , 12.81391086, 14.66640079,\n",
       "       21.41278204, 25.58779666, 29.07158369, 25.31130562, 37.33866563,\n",
       "       25.20347412, 16.68478535, 26.6135784 , 20.58330893, 27.91585117,\n",
       "       26.41726976, 44.49978342, 16.15945238, 43.39381929, 22.38050066,\n",
       "       26.60528367, 26.14354364, 24.03944686, 25.58779666, 41.18189101,\n",
       "       13.06275279, 35.12673735, 23.76295583, 46.15872963, 21.27453652,\n",
       "       25.20347412, 24.3159379 , 24.86891997, 23.92608554, 16.85067997,\n",
       "       25.0099304 , 26.0523016 , 25.17582502, 25.75645619, 25.97488411,\n",
       "       25.36660383, 26.533396  , 23.62471031, 30.50933707, 25.1702952 ,\n",
       "       18.20548604, 24.58966402, 20.16857238, 31.25586287, 23.18232466,\n",
       "       28.352707  , 28.18404747, 25.03481459, 31.14526645, 23.84590314,\n",
       "       19.20085376, 27.32969018, 24.2882888 , 25.30301089, 35.70736852,\n",
       "       20.22387059, 25.33895473, 24.61454822, 50.38904246, 28.15363346,\n",
       "       30.42638976, 19.89208135, 25.00716549, 25.00716549, 28.18681238,\n",
       "       17.40366203, 44.77627446, 21.35748383, 43.94680135, 23.20997376,\n",
       "       19.94737955, 39.10820825, 14.85994452, 26.52786618, 12.42682341,\n",
       "       25.30854071, 21.60632576, 24.86615506, 30.95172273, 15.74471583,\n",
       "       24.03944686, 25.25600742, 37.9469459 , 16.57418893, 23.95096973,\n",
       "       30.20519694, 25.19517939, 24.89103925, 24.03944686, 17.81839859,\n",
       "       23.29292107, 20.99804548, 26.69652571, 26.16842783, 14.77699721,\n",
       "       25.31130562, 21.55102755, 37.86399859, 18.50962617, 47.5411848 ,\n",
       "       25.17306011, 24.03944686, 17.40366203, 25.11223208, 14.80464631,\n",
       "       26.66611169, 26.41726976, 25.145411  , 33.21894921, 11.84619224,\n",
       "       24.53989564, 23.76295583, 25.05969878, 25.2781267 , 16.07650507,\n",
       "       26.60528367, 27.38498838, 42.34315335, 20.52801073, 27.54535318,\n",
       "       21.02569459, 24.9573971 , 24.58966402, 27.88543716, 23.4864648 ,\n",
       "       22.93348273, 27.19697448, 24.03944686, 19.89208135, 15.10878645,\n",
       "       40.90539997, 23.29292107, 20.99804548, 14.6940499 , 14.97054093,\n",
       "       25.69839307, 28.01538794, 22.43579886, 44.77627446, 36.48154342,\n",
       "       20.72155445, 23.90120135, 25.64309487, 21.55102755, 24.81638667,\n",
       "       24.17769238, 28.40800521, 25.42190204, 36.86863087, 15.74471583,\n",
       "       14.7493481 , 23.90120135, 47.76237763, 23.84617963, 21.82751859,\n",
       "       46.15872963, 21.82751859, 20.72155445, 22.38050066, 23.84590314,\n",
       "       26.7214099 , 30.95172273, 25.42190204, 22.93348273, 22.93348273,\n",
       "       25.50484935, 34.24196604, 22.93348273, 24.56229141, 25.05693387,\n",
       "       22.93348273, 29.56926756, 23.20997376, 25.42190204, 25.08458298,\n",
       "       22.24225514, 79.33765378, 24.56477983, 26.25137514, 59.98328136,\n",
       "       24.61454822, 24.17769238, 24.81638667])"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_predict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "644fef1f",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([27.06938776, 26.03102041, 50.1933373 , 16.64932362, 22.69041429,\n",
       "       46.20408163, 28.16751701, 47.26725255, 42.5170068 , 23.84372307,\n",
       "       21.96712018, 26.09349885, 29.30292481, 17.20612631, 26.01974162,\n",
       "       22.65625   , 27.36326531, 26.51428571, 28.62643606, 26.80840995,\n",
       "       23.71185097, 57.85667324, 38.56829803, 24.53512397, 23.61606553,\n",
       "       22.55379292, 26.47208982, 23.57972478, 22.98539751, 19.84126984,\n",
       "       16.09578527, 26.47543184, 23.44489796, 27.86894522, 38.82917265,\n",
       "       29.296875  , 16.60596746, 25.55819791, 13.24264673, 16.48100804,\n",
       "       22.22222222, 24.60129469, 27.22222222, 23.54500694, 36.45061728,\n",
       "       23.66057579, 15.01730104, 27.12287541, 20.37273243, 27.75135421,\n",
       "       25.96115735, 46.48760331, 16.62393847, 49.6031746 , 22.40817899,\n",
       "       26.48935815, 24.22209045, 22.85714286, 26.15916955, 39.85025963,\n",
       "       13.46666667, 36.78706272, 23.05456246, 47.34250726, 22.03856749,\n",
       "       23.68731846, 23.45091822, 25.25951557, 23.25169568, 17.1875    ,\n",
       "       24.58988152, 24.94834711, 24.76193658, 25.1717532 , 24.57786715,\n",
       "       25.5805205 , 26.40248588, 22.88750042, 26.85277692, 25.33771075,\n",
       "       16.72309429, 23.53382689, 20.32225287, 29.66049383, 23.14878893,\n",
       "       27.95102041, 28.72836668, 24.61998748, 27.66215747, 23.42482423,\n",
       "       19.51963117, 27.68388318, 23.68939824, 24.35495428, 36.63673469,\n",
       "       20.15131414, 31.09261186, 23.80763641, 54.59770115, 28.36045307,\n",
       "       27.49881853, 19.95935549, 25.73439305, 23.46069137, 32.38835543,\n",
       "       17.52781588, 46.81043388, 22.47447302, 41.49013879, 25.21735858,\n",
       "       21.42836347, 39.73953845, 15.92797784, 26.0932752 , 12.95756398,\n",
       "       23.81399322, 20.21403092, 24.41593596, 32.11195241, 16.64932362,\n",
       "       20.23355301, 24.40531721, 37.54564464, 15.7943067 , 23.58068347,\n",
       "       26.39480683, 25.07436452, 24.44604192, 22.83104278, 16.63107034,\n",
       "       22.22882811, 22.48132907, 25.99510204, 26.57227865, 16.22222222,\n",
       "       23.55029885, 22.40587695, 41.52249135, 19.05197378, 48.37551887,\n",
       "       25.64013841, 20.23355301, 17.52781588, 24.40216673, 16.05192755,\n",
       "       25.95918367, 26.56841536, 25.30693205, 38.84225978, 12.15049728,\n",
       "       22.92125507, 23.32341806, 24.65009345, 24.8855625 , 15.6988264 ,\n",
       "       26.79826933, 25.36768466, 40.67007077, 18.71020408, 26.99755102,\n",
       "       22.29865559, 25.37024221, 23.50693878, 27.39918367, 22.46003435,\n",
       "       22.83737024, 26.58612245, 23.38868656, 20.44913742, 15.69198751,\n",
       "       38.69328922, 23.28719723, 19.94321255, 16.30557182, 15.89132385,\n",
       "       24.53512397, 27.87026027, 23.26996677, 51.99182473, 36.29592223,\n",
       "       21.30394858, 22.95547628, 29.98299118, 21.3577956 , 24.35572403,\n",
       "       22.25097841, 25.90266876, 23.67125363, 36.32845417, 16.64932362,\n",
       "       16.17777778, 22.98188465, 53.9100346 , 22.32172191, 22.4996371 ,\n",
       "       49.54419342, 19.56823633, 19.15708812, 22.14532872, 23.56161123,\n",
       "       31.9259734 , 34.89439853, 25.95155709, 19.92512982, 22.5710475 ,\n",
       "       27.6584022 , 31.57490548, 22.05219018, 23.42104783, 25.19749667,\n",
       "       22.5710475 , 35.15625   , 22.91303307, 24.21229339, 24.65167563,\n",
       "       22.49858277, 63.01197227, 24.8204573 , 24.89706023, 55.40166205,\n",
       "       23.83502512, 23.80276321, 24.32757526])"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "8da92d53",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAo/klEQVR4nO3de3xcVb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RWbWHC3/shAU6rXrugtPrl57Vk+lFxERfwrgIiI5SgE8toaBbsAAKtRr13UXnpy8do2Bi4jkKPXARURylAK4iEiOUgDvwczWmlmLmb1gZs3Buoysf55Jia7zbmZXm9nrZvaqmX1xYFrdfz7XfZ2ZvRP8zl8wsxkRr+XLdU80syfMbLWZrTKzOcH6QvjO/a49979355x+In6AtcCYHnXzgLnB53OBnw50O1NwnccD04CXY10n8AngRWAwcBDwBlA80NeQwuu+DrgyyrH5dN0TgGnB58OB14LXVwjfud+15/z3rh54fPJu/XOX2DrvM4F7nHN7nHNvAq8DR2Winanmc91+8um61zvnng8+fxdYDRxAYXznftfuJ2euXQG8Nwc8amYrzaw2WBf3+uc5zu86DwDeijjubfr+B5CLvmVmLwWHWELDCHl53WZWCRwBPEuBfec9rh1y/HtXAO/tOOfcNOAU4JvBLeUKnUWpy6f80wXAR4CpwHrgv4P1eXfdZjYMeAC4zDm3o69Do9Tl27Xn/PeuAN6Dc25d8HEj8CDen06Fsv6533W+DUyMOO5AYF2G25Y2zrkNzrkO51wn8AvCfy7n1XWbWQleAAs455YEqwviO4927fnwvSuARzCzoWY2PPQc+ALwMoWz/rnfdS4DzjGzwWZ2EDAFeG4A2pcWoQAWdCbedw55dN1mZsCdwGrn3I0RL+X9d+537XnxvQ/0XdRs+gE+jHf3+UVgFVAXrB8NNAFrgo8VA93WFFzr3Xh/Nu7D63HM6us6gTq8u/GvAqcMdPtTfN2LgRbgJbx/vBPy8Lo/izcM8BLwQvBnRoF8537XnvPfu6bSi4jkKA2hiIjkKAVwEZEcpQAuIpKjFMBFRHKUAriISI5SABcRyVEK4CIiOer/AyyP9UwlvSpfAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X,y,c=\"g\")#原始点值\n",
    " \n",
    "#plt.scatter(X,y_predict,c=\"b\")#预测点值\n",
    " \n",
    "plt.plot(X_test,y_predict,'Red')#预测直线\n",
    " \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0d43176",
   "metadata": {},
   "source": [
    "身体质量指数(BMI) = 体重（公斤）除以身高（米）的平方"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "b7c8362f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.27649103]\n",
      "4.685074444455477\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([25.42190204])"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(linreg.coef_)#输出斜率\n",
    " \n",
    "print(linreg.intercept_)#截距\n",
    " \n",
    "linreg.predict([[75]])#预测75的值"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43c80277",
   "metadata": {},
   "source": [
    "### Step8：评估指标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "c849dcf0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "均方误差（MSE）： 5.317227468654762\n",
      "均方根误差（RMSE）： 2.3059114182150973\n",
      "平均绝对误差（MAE）： 1.4445498844767182\n",
      "R2分数： 0.930531636814612\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n",
    "\n",
    "# 评估指标\n",
    "mse = mean_squared_error(y_test, y_predict)\n",
    "rmse = np.sqrt(mse)\n",
    "mae = mean_absolute_error(y_test, y_predict)\n",
    "r2 = r2_score(y_test, y_predict)\n",
    "\n",
    "print(\"均方误差（MSE）：\", mse)\n",
    "print(\"均方根误差（RMSE）：\", rmse)\n",
    "print(\"平均绝对误差（MAE）：\", mae)\n",
    "print(\"R2分数：\", r2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2dc4e223",
   "metadata": {},
   "source": [
    "这些指标都是用来衡量线性回归模型的预测性能的。\n",
    "\n",
    "- 均方误差（MSE）：它是实际观察值与预测值之间差的平方的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MSE为5.317227468654762。\n",
    "- 均方根误差（RMSE）：它是MSE的平方根，也是衡量模型预测精度的一种常用指标。在这个例子中，RMSE为2.3059114182150973。\n",
    "- 平均绝对误差（MAE）：它是实际观察值与预测值之间差的绝对值的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MAE为1.4445498844767182。\n",
    "- R2分数：它是决定系数，用于衡量模型对数据的拟合程度。它的取值范围在0到1之间，越接近1表示模型对数据的拟合程度越高。在这个例子中，R2分数为0.930531636814612。\n",
    "\n",
    "综合来看，这个线性回归模型的预测性能较好，但还有改进的空间。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fd6da3d4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9bb04c26",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "826b1c23",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Weight-Height:0.607672"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "6a555164",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.array(df[\"Weight\"])\n",
    "X=x.reshape(-1,1)#-1表示所有行，1表示变成1列。——将数组x重塑为列向量。(因为fit函数中的X必须是二维数组)\n",
    "y = np.array(df[\"Height\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "b97198c4",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1.71669588, 1.71154509, 1.80108474, 1.64720871, 1.69484549,\n",
       "       1.8116131 , 1.71118874, 1.80108474, 1.77678852, 1.70341395,\n",
       "       1.68284316, 1.70600555, 1.75556983, 1.65465955, 1.69855471,\n",
       "       1.67636417, 1.71815366, 1.71394231, 1.72932992, 1.71088099,\n",
       "       1.69870049, 1.93876329, 1.79622549, 1.70551962, 1.69823076,\n",
       "       1.69596473, 1.71071901, 1.70343015, 1.69256164, 1.67312467,\n",
       "       1.64186354, 1.71073521, 1.69871668, 1.74196395, 1.76204882,\n",
       "       1.70389988, 1.66292026, 1.70775488, 1.63003938, 1.64089169,\n",
       "       1.68041354, 1.70487173, 1.72528055, 1.70325198, 1.773711  ,\n",
       "       1.70262028, 1.65271585, 1.71088099, 1.67555429, 1.71851   ,\n",
       "       1.70973097, 1.81566247, 1.64963833, 1.80918347, 1.68608265,\n",
       "       1.7108324 , 1.70812742, 1.69580114, 1.70487173, 1.79622549,\n",
       "       1.63149716, 1.76075302, 1.69418139, 1.82538095, 1.67960366,\n",
       "       1.70262028, 1.69742089, 1.70066038, 1.69513704, 1.6536877 ,\n",
       "       1.70148645, 1.7075929 , 1.7024583 , 1.70585977, 1.70713937,\n",
       "       1.70357593, 1.71041126, 1.69337152, 1.73370323, 1.70242591,\n",
       "       1.66162446, 1.69902444, 1.67312467, 1.73807655, 1.69077992,\n",
       "       1.7210692 , 1.72008116, 1.70163223, 1.73742865, 1.69466732,\n",
       "       1.66745555, 1.71507614, 1.69725891, 1.70320339, 1.76415449,\n",
       "       1.67344862, 1.70341395, 1.69917021, 1.85016309, 1.71990298,\n",
       "       1.73321731, 1.67150492, 1.70147026, 1.70147026, 1.72009735,\n",
       "       1.6569272 , 1.81728221, 1.68008959, 1.81242297, 1.6909419 ,\n",
       "       1.67182887, 1.78407739, 1.64202552, 1.71037887, 1.62777174,\n",
       "       1.70323578, 1.68154736, 1.70064418, 1.73629483, 1.64720871,\n",
       "       1.69580114, 1.70292803, 1.77727445, 1.65206795, 1.69528282,\n",
       "       1.73192151, 1.70257168, 1.70078996, 1.69580114, 1.65935682,\n",
       "       1.69142782, 1.67798391, 1.71136691, 1.7082732 , 1.64153959,\n",
       "       1.70325198, 1.68122341, 1.77678852, 1.66340619, 1.83347969,\n",
       "       1.7024421 , 1.69580114, 1.6569272 , 1.70208576, 1.64170157,\n",
       "       1.71118874, 1.70973097, 1.70228013, 1.74957676, 1.62437027,\n",
       "       1.69873288, 1.69418139, 1.70177801, 1.70305761, 1.64915241,\n",
       "       1.7108324 , 1.71540009, 1.80302843, 1.67523034, 1.71633954,\n",
       "       1.67814589, 1.7011787 , 1.69902444, 1.71833183, 1.69256164,\n",
       "       1.68932215, 1.71429866, 1.69580114, 1.67150492, 1.64348329,\n",
       "       1.79460575, 1.69142782, 1.67798391, 1.64105367, 1.64267342,\n",
       "       1.70551962, 1.71909311, 1.6864066 , 1.81728221, 1.76868978,\n",
       "       1.67636417, 1.69499126, 1.70519568, 1.68122341, 1.70035263,\n",
       "       1.69661101, 1.72139315, 1.70389988, 1.77095743, 1.64720871,\n",
       "       1.64137762, 1.69499126, 1.83477549, 1.69466894, 1.68284316,\n",
       "       1.82538095, 1.68284316, 1.67636417, 1.68608265, 1.69466732,\n",
       "       1.71151269, 1.73629483, 1.70389988, 1.68932215, 1.68932215,\n",
       "       1.7043858 , 1.75556983, 1.68932215, 1.69886408, 1.70176181,\n",
       "       1.68932215, 1.72819609, 1.6909419 , 1.70389988, 1.70192378,\n",
       "       1.68527278, 2.01975067, 1.69887866, 1.70875912, 1.90636833,\n",
       "       1.69917021, 1.69661101, 1.70035263])"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    " \n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=42)\n",
    "linreg=LinearRegression()#创建LinearRegression类的实例对象\n",
    "linreg.fit(X,y)\n",
    "y_predict=linreg.predict(X_test)\n",
    "y_predict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "5d111a2d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0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3EVkMnAU8BRl9L2nzRtK4DtXQffmOGPM0cDJwCUicny+B1QAiENbqVmllgKHAEcCbwI/GmwvubmLyBjgV8B8Y8w2r64ObUU7d4d5l8R3roLugTHmjcH/bgDuxnrUeltE9gcY/O+G/I0wVtzmuR44KKnfJOCNHI8tVowxbxtj+o0xA8BPGX7ELqm5i0g1lqgljDF3DTaX/PfuNO9S+c5V0F0QkdEiMtb+GTgReB64F2gZ7NYC3JOfEcaO2zzvBc4Skb1E5GDgMODpPIwvNmxBG+QMrO8dSmjuIiLAz4AXjTHXJr1U0t+727xL5jvP965sof4BPoi1u70WeAFoG2wfD3QCLw/+d1y+xxrBXO/Aeszcg7Ui+ZLXPIE2rN3+vwAn53v8Mcz9NqAb+BPWP+j9S23uwCewQgd/AtYM/plR6t+7x7xL4jvXTFFFUZQSQUMuiqIoJYIKuqIoSomggq4oilIiqKAriqKUCCroiqIoJYIKuqIoSomggq4oilIiqKAriqKUCP8PRf00+Lxs/CIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X,y,c=\"g\")#原始点值\n",
    " \n",
    "#plt.scatter(X,y_predict,c=\"b\")#预测点值\n",
    " \n",
    "plt.plot(X_test,y_predict,'Red')#预测直线\n",
    " \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "9982f5d8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "均方误差（MSE）： 0.004602807109702035\n",
      "均方根误差（RMSE）： 0.0678439909623692\n",
      "平均绝对误差（MAE）： 0.05320966584449583\n",
      "R2分数： 0.3970282667901889\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n",
    "\n",
    "# 评估指标\n",
    "mse = mean_squared_error(y_test, y_predict)\n",
    "rmse = np.sqrt(mse)\n",
    "mae = mean_absolute_error(y_test, y_predict)\n",
    "r2 = r2_score(y_test, y_predict)\n",
    "\n",
    "print(\"均方误差（MSE）：\", mse)\n",
    "print(\"均方根误差（RMSE）：\", rmse)\n",
    "print(\"平均绝对误差（MAE）：\", mae)\n",
    "print(\"R2分数：\", r2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be12b1b0",
   "metadata": {},
   "source": [
    "这些指标都是用来衡量线性回归模型的预测性能的。\n",
    "\n",
    "- 均方误差（MSE）：它是实际观察值与预测值之间差的平方的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MSE为0.004602807109702035，非常小，说明模型的预测精度很高。\n",
    "- 均方根误差（RMSE）：它是MSE的平方根，也是衡量模型预测精度的一种常用指标。在这个例子中，RMSE为0.0678439909623692，也比较小，说明模型的预测精度很高。\n",
    "- 平均绝对误差（MAE）：它是实际观察值与预测值之间差的绝对值的平均值，数值越小表示模型的拟合效果越好。在这个例子中，MAE为0.05320966584449583，也较小，说明模型的预测精度很高。\n",
    "- R2分数：它是决定系数，用于衡量模型对数据的拟合程度。它的取值范围在0到1之间，越接近1表示模型对数据的拟合程度越高。在这个例子中，R2分数为0.3970282667901889，比较低，说明模型对数据的拟合程度不高。\n",
    "\n",
    "综合来看，这个线性回归模型的预测精度很高，但模型对数据的拟合程度不高。可能需要进一步优化模型或者考虑使用其他类型的回归模型来提高拟合程度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "dd4d9d32",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1.72819609])"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linreg.predict([[90]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d21b3099",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
